<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/assets/cashier/css/main.css"/>
    <link rel="stylesheet" href="/assets/cashier/css/iconfont.css">
    <link rel="stylesheet" href="/assets/cashier/css/print.css">
    <script type="text/javascript" src="/assets/cashier/js/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/main.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery-migrate-1.2.1.min.js"></script>
    <link rel="stylesheet" href="/assets/cashier/css/input.css"/>
    <script type="text/javascript" src="/assets/cashier/js/classie.js"></script>
    <title>会员</title>
    <style>
    	.sex-box{
    		padding-top: 10px;
    		padding-left: 13px;
    		color: #D1D1D1;
    		height: 30px;	
    		margin: 0 10px;
    		border-bottom: 1px solid #B9C1CA;
    	}
    	.sex{
		    width: 16px;
		    height:16px;
		    position: relative;
		}
		.sex input[type=radio]{
		    opacity: 0;
		    width:100%;
		    height: 100%;
		    position: absolute;
		    top:0;
		    left:0;
		    z-index: 2;
		}
		.sex label{
		    cursor: pointer;
		    position: absolute;
		    width: 16px;
		    height:16px;
		    border-radius: 50%;
		    top: 0;
		    left: 0;
		    border:1px solid #999;
		}
		.sex label:after{
		    opacity: 0.2;
		    content: '';
		    position: absolute;
		    width: 10px;
		    height: 7px;
		    background: transparent;
		    top: 3px;
		    left: 3px;
		    border: 2px solid #fff;
		    border-radius: 2px;
		    border-top: none;
		    border-right: none;
		    -webkit-transform: rotate(-45deg);
		    -moz-transform: rotate(-45deg);
		    -o-transform: rotate(-45deg);
		    -ms-transform: rotate(-45deg);
		    transform: rotate(-45deg);
		}
		.sex label:hover::after{
		    opacity: 1;
		}
		.sex input[type=radio]:checked + label {
		    background: #51d4a8;
		    border: none;
		}
		.sex input[type=radio]:checked+label:after{
		    opacity: 1;
		}
    </style>
</head>
<body>
    <div class="container">
        <div class="nav">
            <div class="user-head">
                <img src="/assets/logo.png"/>
            </div>
            <div class="nav-con">
                <ul>
                     <li class="nav-list">
                        <a href="/cashier/index/index/index">
                            <span class="iconfont icon-shouyin"></span>
                            <p data-locale="msg_shouyin">收银台</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/order">
                            <span class="iconfont icon-guadan"></span>
                            <p data-locale="msg_guadan">挂单</p>
                        </a>
                    </li>
                    <li class="nav-list active">
                        <a href="/cashier/index/index/members">
	                        <span class="iconfont icon-huiyuan"></span>
	                        <p data-locale="msg_huiyuan">会员</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/count">
                            <span class="iconfont icon-tongji"></span>
                            <p data-local="msg_tongji">统计</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/change">
                            <span class="iconfont icon-tuihuo"></span>
                            <p data-locale="msg_tuihuanhuo">退换货</p>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="nav-foot">
                <div class="nav-foot-list nav-lock">
                    <span class="iconfont icon-suo"></span>
                    <p data-locale="suoding">锁定</p>
                </div>
                <div class="nav-foot-list nav-cancel">
                    <a href="/cashier/index/index/exchange">
                        <span class="iconfont icon-tuichu"></span>
                        <p data-locale="msg_jiaoban">交班</p>
                    </a>
                </div>
            </div>
        </div>
        <div class="content">
            <div class="members-list">
                <div class="members-list-head">-<span style="margin: 0 10px" data-locale="msg_addvip">添加会员</span>-</div>
                <div class="members-list-form">
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-4" name="phone">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-4">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_rechargevip">手机号码</span>
                        </label>
                    </span>
                    <span class="input input--hoshi" style="width: 148px;">
                        <input class="input__field input__field--hoshi" type="text" id="input-5" name="name">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-5">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_name">名字</span>
                        </label>
                    </span>
                    <span class="input input--hoshi" style="width: 148px;">
                        <input class="input__field input__field--hoshi" type="text" id="input-6"  name="lastName">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-6">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_xing">姓氏</span>
                        </label>
                    </span>
                    <div class="sex-box">
	                    	<span style="float: left;margin-right: 10px;">性别：</span>
							<div class="sex" style="float: left;margin-right: 10px;">
					            <input type="radio" name="sex" checked value="0">
					            <label></label>
					        </div>
					        <div style="float: left;margin-right: 10px;">男</div>
							<div class="sex" style="float: left;margin-right: 10px;">
					            <input type="radio" name="sex" value="1">
					            <label></label>
					        </div>
					         <div style="float: left;margin-right: 10px;">女</div>
					</div>
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-7" name="email">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-7">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_email">电子邮箱</span>
                        </label>
                    </span>
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-8" name="wx">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-8">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_wechat">微信号</span>
                        </label>
                    </span>
                    <div class="birthday-box">
                        <p data-locale="msg_birthday">出生日期</p>
                        <select name="birthday_year" value="" id="year" onfocus="years('year',new Date().getFullYear()),change_date()">
                            <option value="0" data-locale="msg_year">-年-</option>
                        </select>
                        <select name="birthday_year" value="" id="month" onfocus="months(),change_date()">
                            <option value="0" data-locale="msg_month">-月-</option>
                        </select>
                        <select name="birthday_year" value="" id="date" >
                            <option value="0" data-locale="msg_day">-日-</option>
                        </select>
                    </div>
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-10" name="pay_pass">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-10">
                            <span class="input__label-content input__label-content--hoshi" >支付密码</span>
                        </label>
                    </span>
                    <span class="input input--hoshi" style="width: 148px;">
                        <input class="input__field input__field--hoshi reg-recharge" type="text" id="input-11" name="money">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-11">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_rechargemoney">充值金额</span>
                        </label>
                    </span>
                     <span class=" input input--hoshi" style="width: 148px;color: #D1D1D1;padding-top: 27px;border-bottom: 1px solid #B9C1CA;">
                     	<span style="margin-right: 10px;">赠送金额</span>
                     	<span class="reg-present"></span>
                        <!--<input class="input__field input__field--hoshi reg-present" type="text" id="input-12" name="present" readonly="readonly">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-12">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_jifen">赠送金额</span>
                        </label>-->
                    </span>
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-12" name="credit">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-12">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_jifen">积分</span>
                        </label>
                    </span>
                    <span class="input input--hoshi">
                        <input class="input__field input__field--hoshi" type="text" id="input-10" name="note">
                        <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-10">
                            <span class="input__label-content input__label-content--hoshi" data-locale="msg_remark">备注</span>
                        </label>
                    </span>
                    <div class="members-pay">
                        <ul>
                            
                        </ul>
                    </div>
                    <div class="members-list-foot">
                        <div class="btn-active members-clear" style="background: #ccc;margin-right: 15px;" data-locale="msg_clear">清空</div>
                        <div class="btn-active members-submit" data-locale="msg_submit">提交</div>
                    </div>
                </div>
            </div>
            <div class="members-list recharge-box">
                <div class="members-list-head">-<span style="margin: 0 10px" data-locale="msg_rechargevip">会员充值</span>-</div>
                <div class="members-info">
                    <div class="members hide">
                        <div class="members-img">
                            <img src="/assets/avatar.png"/>
                        </div>
                        <div class="members-con">
                            <div class="members-name"></div>
                            <div style="font-size: 16px;color: #666;">
                                <span data-locale="msg_yue">余额</span>：<span class="members-balance"></span>
                                <span style="margin-left: 20px" data-locale="msg_zhekou">折扣</span>：<span class="members-credits"></span>
                            </div>
                        </div>
                    </div>
                    <div class="members-search">
                        <input type="text" name="phone" placeholder="手机号码" class="members-phone">
                        <div class="btn-active pull-right btn-search" style="width: 100px;margin-top: 17px;height: 35px;line-height: 35px" data-locale="msg_search">搜索</div>
                    </div>
                </div>
                <div class="members-body hide">
                    <div class="members-recharge">
                        <span data-locale="msg_rechargemoney">充值金额</span><input type="text" name="money" class="recharge-input pull-right" style="text-align: right;"/>
                    </div>
                    <div class="members-recharge" style="margin-top: 20px;color: #666;">
                        <span>赠送金额</span><span class="present pull-right">0</span>
                    </div>
                    <div class="members-pay recharge-list">
                        <ul>
                           
                        </ul>
                    </div>
                    <div class="members-list-foot">
                        <div class="btn-active recharge-clear" style="background: #ccc;margin-right: 15px;" data-locale="msg_clear">清空</div>
                        <div class="btn-active recharge-submit" data-locale="msg_submit">提交</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="popbg">
        <!--锁定-->
         <div class="popbox" id="lock">
            <div class="pop-head" data-locale="msg_qxsd">请填写你的密码取消锁定</div>
            <div class="pop-body">
                <input class="lock-input" name="password">
            </div>
            <div class="pop-foot">
                <div class="centerButton lock-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <div class="print-recharge" id="printer">
        	<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>        	
			<div class="line-type"><span class="pull-left offline">OFFLINE</span><span class="pull-right">顾客线下充值小票</span></div>
			<div class="print-list">收银员工：<span class="cashier-name"></span></div>
			<div class="print-list">充值时间：<span class="recharge-time"></span></div>
			<div class="print-list">会员姓名：<span class="recharge-name"></span></div>
			<div class="print-list">会员微信：<span class="recharge-weixin"></span></div>
			<div class="print-list">会员电话：<span class="recharge-phone"></span></div>
			<div class="print-list">会员备注：<span class="recharge-note"></span></div>
			<div class="print-list">充值方式：<span class="print-recharge-payMode"></span></div>
			
			<div class="print-list" >上次余额：<span class="last-balance"></span></div>
			<div class="print-list" >本次充值：<span class="recharge-money"></span></div>
			<div class="print-list" >赠送金额：<span class="present-money"></span></div>
			<div class="print-list" >当前余额：<span class="now-balance"></span></div>
			<div class="line"></div>
			<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
			<div class="print-time">感谢惠顾，期待您的再次光临</div>
			<div class="print-time">加入会员，更多折扣，更多优惠，更多方便</div>
			<div class="print-time">扫我↓</div>
			<div class="code"><img src="../../../assets/cashier/img/richubao.jpg" /></div>
		</div>
		<div id="online" class="print-online">
        	<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>
			
			<div class="line-type"><span class="pull-left">ON-LINE</span><span class="pull-right">顾客线上消费送货小票</span></div>
			<div class="print-list">送货时间：<span class="delivery-time"></span></div>
			<div class="print-list">收银员工：<span class="cashier-name"></span></div>
			<div class="print-list">消费时间：<span class="order-time"></span></div>
			<div class="print-list">线上订单：<span class="order_id"></span></div>
			
			<div class="print-list vip-name-box">会员姓名：<span class="vip-name"></span></div>
			<div class="print-list">微信号码：<span class="vip-weixin"></span></div>
			<div class="print-list">送货地址：<span class="vip-address"></span></div>
			<div class="print-list">送货邮编：<span class="vip-site"></span></div>
			<div class="print-list">联系电话：<span class="vip-phone"></span></div>
			<div class="print-list">备注：<span class="vip-remark"></span></div>
			<div class="print-list">支付方式：<span class="print-order-payMode"></span></div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>单价(￡)</span>
				<span>数量</span>
				<span>金额(￡)</span>
			</div>
			<div class="line"></div>
			<div class="print-table-body"> </div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>共计</span>
				<span class="print-table-total-food"></span>
				<span class="print-table-total-price"></span>
			</div>
			<div class="line"></div>
			<div class="consumption"></div>
			
			<div class="line"></div>
			<div class="print-list text-center">VAT RECEIPT SUMMARY</div>
			<div class="print-list text-center">NET：<span class="vat-net"></span></div>
			<div class="print-list text-center">20%VAT：<span class="vat-20"></span></div>
			<div class="print-list text-center">GROSS：<span class="vat-gross"></span></div>
			<div class="print-list text-center">VAT No. : 157965263</div>
			<div class="line"></div>
			<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
			<div class="print-time">感谢惠顾，期待您的再次光临</div>
			<div class="print-time">加入会员，更多折扣，更多优惠，更多方便</div>
			<div class="print-time">扫我↓</div>
			<div class="code"> <img src="../../../assets/cashier/img/richubao.jpg" /></div>
		</div>
    </div>
    <div class="tip hide"></div>
    <script type="text/javascript">
        $(function () {
           lock();
           $('.note-val').attr('placeholder',lang('INDEX_NO_PHONE'))
            //添加会员
            var pays=[];//支付方式
            var pay_types=SITE_CONFIG.pay_types;
            var units=SITE_CONFIG.units;;
    		
            $.ajax({
                type:'GET',
                data:'',
                url:urlHead+'//goods/basic',
                dataType:'json',
                success:function (json) {
                   
                    pay_types=json.pay_types;
                    units=json.units;
                    var li='';
					 $.each(pay_types,function (index,item) {
	                    	if(index == 2 || index ==3 || index ==7) return;
	                        li+='<li class="btn-middle btn-middle-primay" data-id="'+index+'">'+(SITE_LANG=='chinese'?item.chinese:item.english)+'</li>'
	                    });
                    $('.members-pay ul').html(li);
                    $('.members-list-form ul li').first().hide();
                    $('.recharge-box ul li').first().hide();
                }
            })
            //赠送列表
             getpresent()
		    var rechargePresent=[];
		    function getpresent(){
           		$.ajax({
		    		type:'GET',
                    data:'',
                    dataType:'json',
                    url:urlHead+'/recharge/getRechargePresent',
                    success:function (json) {
                    	console.log(json)
                    	rechargePresent=json;
                    }
                })
           	}

            $('.members-clear').click(function () {
				clearadd();
            });
            function clearadd(){
            	$('.members-list-form .input input').val('');
                $('.members-list-form  select').each(function () {
                    $(this).find("option").eq(0).prop('selected',true);
                });
                $('.members-list-form .members-pay .btn-middle').each(function(){
                	$(this).addClass('btn-middle-primay').removeClass('btn-middle-active');
                })
            }
            $('body').on('click','.members-list-form .btn-middle',function () {
                var payId=$(this).attr('data-id');
                if($(this).hasClass('btn-middle-active')){
					pays.splice(0,1);
					$(this).addClass('btn-middle-primay').removeClass('btn-middle-active');
					 
				}else{
					  $(this).addClass('btn-middle-active').removeClass('btn-middle-primay');
					  $(this).siblings().addClass('btn-middle-primay').removeClass('btn-middle-active');
					  if(pays.length>0){
                        pays.splice(0,1);
                    }
					 pays.push(payId);
				}

                console.log(pays);
            });
            
//          注册会员赠送金额
			 $('.reg-recharge').keyup(function(){
					var money=$(this).val();
					var present='';
					$.each(rechargePresent,function(index,item){
						if(money>0 && Number(money)>=Number(item.value)){
							present=item.value1;
						}
					})
					$(".reg-present").html(present)
				})
            $('.members-submit').click(function () {
               var phone=$('.members-list-form input[name=phone]').val();
                var first_name=$('.members-list-form input[name=name]').val();
                var last_name=$('.members-list-form input[name=lastName]').val();
                var year=$('#year').val();
                var month=$('#month').val();
                var day=$('#date').val();
                var birthday=year+'-'+toAdd(month)+'-'+toAdd(day);
                if(!phone){
                    tip('请输入手机号码');
                    return;
                }
                
                if(!first_name){
                    tip('请填写名字');
                    return;
                }
                if(!last_name){
                    tip('请填写姓氏');
                    return;
                }
               var data={
                   phone:phone,
                   first_name:first_name,
                   last_name:last_name,
                   email:$('.members-list-form input[name=email]').val(),
                   wechat:$('.members-list-form input[name=wx]').val(),
                   sex:$('input:radio[name="sex"]:checked').val(),
                    birthday:birthday,
                    pay_pass:$('.members-list-form input[name=pay_pass]').val(),
                    money:$('.members-list-form input[name=money]').val(),
                    credits:$('.members-list-form input[name=credit]').val(),
                    remark:$('.members-list-form input[name=note]').val(),
                    pay_type:pays[0]
               };
               console.log(data)
                $.ajax({
                    type: 'POST',
                    data: data,
                    url: urlHead+'/user/reg',
                    dataType: 'json',
                    success: function (json) {
                        console.log(json)
                        if(data.money>0){
                        	$('#printer').show().siblings().hide();
	                		var paymode = SITE_CONFIG.pay_types[data.pay_type][SITE_LANG];
	                		var present=$(".reg-present").html()?$(".reg-present").html():0;
	                		var now=parseFloat(data.money)+parseFloat(present)
	                		var username=data.first_name+' '+data.last_name;
		        			$('.print-recharge .cashier-name').html(CASHIER);
		        			$('.print-recharge .recharge-time').html(getTime());
		        			$('.print-recharge .print-recharge-payMode').html(paymode+'支付');
		        			$('.print-recharge .recharge-name').html(username);
		        			$('.print-recharge .recharge-weixin').html(data.wechat);
		        			$('.print-recharge .recharge-phone').html(data.phone);
		        			$('.print-recharge .recharge-note').html(data.remark);
		        			$('.print-recharge .last-balance').html(0);
		        			$('.print-recharge .recharge-money').html(data.money);
		        			$('.print-recharge .present-money').html(present);
		        			$('.print-recharge .now-balance').html(now.toFixed(2));
			            	$('.print-recharge .print-time-detail').html(getTime());
			            	$('#printer').jqprint();
                        }
                        tip('会员添加成功');
                        clearadd()
                    },
                    error:function(res){
                    	var data=res.responseJSON;
                    	if(data.error == 2){
                    		tip('手机号已经被注册');
                    		return;
                    	}else if(data.error == 3){
                    		tip('邮箱已经被注册');
                    		return;
                    	}
                    }
                })
            });
            //会员充值
            
            var rechargePay=[];
            var user_id="";
            var memberPhone='';
            function searchVip(){
            	var phone=$('.members-phone').val();
                if(!phone){
                    tip('请输入手机号码');
                    return;
                }
                var params={phone:phone};
                memberPhone=phone;
                $.ajax({
                    type:'GET',
                    data:params,
                    dataType:'json',
                    url:urlHead+'/user/find_user',
                    success:function (json) {
                        console.log(json);
                        user_id=json.id;
                         var avatar=json.avatar ? json.avatar : "/assets/avatar.png"
                         
                         var name='';
                         if(json.first_name){
                         	name=json.first_name+' '+json.last_name;
                         }else{
                         	name=json.nickname;
                         }

                        $('.members').show().siblings().hide();
                        $('.members').find('img').attr('src',avatar);
                        $('.members .members-name').html(name);
                        $('.members .members-balance').html(json.balance);
                        $('.members .members-credits').html(json.discount);
                        $('.members-search').hide().siblings().show();
                		$('.members-body').show();
                		$('.members-body .recharge-input')[0].focus();
                		
                    },
                    error:function(res){
                		 if(res.responseJSON.error == 404){
                        	tip(lang('MEMBER_NO_USER'));
                        	return;
                        }else if(res.responseJSON.error == 400){
                        	tip(lang('MEMBER_USER_DISABLED'));
                        	return;
                        }	
                    }
                })   
            }
            //赠送金额联动
            $('.recharge-input').keyup(function(){
					var money=$(this).val();
					var present='';
					$.each(rechargePresent,function(index,item){
						if(money>0 && Number(money)>=Number(item.value)){
							present=item.value1;
						}
					})
					console.log(present)
					$(".present").html(present)
				})
            $('.btn-search').click(function () {
                searchVip();
            });
             $('.members-phone').keydown(function (event) {
                if(event.keyCode == 13){
                  searchVip();
                }
            })
            $('body').on('click','.recharge-box .btn-middle',function () {
                var payId=$(this).attr('data-id');

				if($(this).hasClass('btn-middle-active')){
					rechargePay.splice(0,1);
					 $(this).addClass('btn-middle-primay').removeClass('btn-middle-active');
					 
				}else{
					  $(this).addClass('btn-middle-active').removeClass('btn-middle-primay');
					  $(this).siblings().addClass('btn-middle-primay').removeClass('btn-middle-active');
					  if( rechargePay.length>0){
                         rechargePay.splice(0,1);
                    }
					 rechargePay.push(payId);
				}
                console.log(rechargePay);
            });

            $('.recharge-clear').click(function () {
                clearReacharge();
            });
            function clearReacharge(){
            	$('.members-body').hide();
                $('.members').hide().siblings().show();
                $('.members-phone').val('');
                $('.recharge-input').val('');
                $('.recharge-list ul li').each(function () {
                    $(this).removeClass('btn-middle-active').addClass('btn-middle-primay');
                })
            }
            $('.recharge-submit').click(function () {
                var money=$('.members-recharge .recharge-input').val();
                var present=$(".present").html();
                if(!money){
                    tip('请填写充值金额');
                    return;
                }
                if(rechargePay.length<1){
                    tip('请选择充值方式');
                    return;
                }
                var data={
                    money:money,
                    user_id:user_id,
                    pay_type:rechargePay[0]
                };
                $.ajax({
                    type: 'POST',
                    data: data,
                    url: urlHead+'/user/charge',
                    dataType: 'json',
                    success: function (json) {
                        console.log(json)
                        //充值打印
                      
                        $('#printer').show().siblings().hide();
                		var paymode = SITE_CONFIG.pay_types[json.pay_type][SITE_LANG];
	        			$('.print-recharge .cashier-name').html(CASHIER);
	        			$('.print-recharge .recharge-time').html(json.create_time);
	        			$('.print-recharge .print-recharge-payMode').html(paymode+'支付');
	        			$('.print-recharge .recharge-name').html(json.user.username);
	        			$('.print-recharge .recharge-weixin').html(json.user.wechat);
	        			$('.print-recharge .recharge-phone').html(memberPhone);
	        			$('.print-recharge .last-balance').html(json.last);
	        			$('.print-recharge .recharge-money').html(money);
	        			$('.print-recharge .present-money').html(present);
	        			$('.print-recharge .now-balance').html(json.now);
		            	$('.print-recharge .print-time-detail').html(getTime());
		            	$('#printer').jqprint();
                        tip('充值成功');
                        clearReacharge();
                    }
                })
            })
        })
    </script>
    <script>
        (function() {
            // trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
            if (!String.prototype.trim) {
                (function() {
                    // Make sure we trim BOM and NBSP
                    var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
                    String.prototype.trim = function() {
                        return this.replace(rtrim, '');
                    };
                })();
            }

            [].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) {
                // in case the input is already filled..
                if( inputEl.value.trim() !== '' ) {
                    classie.add( inputEl.parentNode, 'input--filled' );
                }

                // events:
                inputEl.addEventListener( 'focus', onInputFocus );
                inputEl.addEventListener( 'blur', onInputBlur );
            } );

            function onInputFocus( ev ) {
                classie.add( ev.target.parentNode, 'input--filled' );
            }

            function onInputBlur( ev ) {
                if( ev.target.value.trim() === '' ) {
                    classie.remove( ev.target.parentNode, 'input--filled' );
                }
            }
        })();
    </script>
</body>
</html>